package com.biz.controller.basic;

import com.biz.model.Pmodel.User;
import com.biz.service.basic.AgentServiceI;
import com.biz.service.basic.UserServiceI;
import com.framework.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * Created by ldd_person on 2017/5/2.
 */
@Controller
@RequestMapping("/jlcmt")
public class JiulingCouponsMTController extends BaseController {

    @Resource(name = "userService")
    private UserServiceI userService;

    @Resource(name = "agentService")
    private AgentServiceI agentServiceI;


    /**
     * 跳转至久零券人工处理页面
     * @param mv
     * @return
     */
    @RequestMapping("/toView")
    public ModelAndView toView(ModelAndView mv){

        mv.setViewName("basic/manualTreatment/manualTreatment");

        return mv;
    }

    @RequestMapping(value = "/doManualTreatment")
    public void doIssuedGift(String phone,String total,String targetBrand,HttpServletResponse response) throws Exception {
    }

    /**
     * 查询商户信息
     * @param response
     * @throws Exception
     */
    @RequestMapping("/queryBrandByAgent")
    public void queryBrandByAgent(HttpServletResponse response) throws Exception {
        User user = (User) getShiroAttribute("user");
        List<Map<String,Object>> brand_agent = agentServiceI.queryBrandByAgent(user.getIdentity_code().toString());
        writeJson(brand_agent,response);
    }
}
